package com.hj.dapp.business.role.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.security.core.GrantedAuthority;

import java.time.LocalDateTime;

/**
 * @author 胡奥程
 * @version 1.0
 * @date 2023/12/29
 */
@Data
@TableName("role")
@Accessors(chain = true)
public class Role  implements GrantedAuthority {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;

    private String expr;

    private String createBy;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    private LocalDateTime createTime;

    private String lastUpdateBy;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    private LocalDateTime lastUpdateTime;

    private Integer delFlag;
    @JsonIgnore
    @Override
    public String getAuthority() {
        return this.expr;
    }

}
